import request from '@/utils/request'

export function verifyToken(): Promise<any> {
    return request({
        method: "get",
        url: "/verifyToken"
    })
}

export function versig(params: { message: string, signature: string }): Promise<any> {
    return request({
        method: "post",
        url: "/versig",
        data: formData(params)
    })
}

export function isUserExist(params: any): Promise<any> {
    return request({
        method: "get",
        url: "/isUserExist",
        params
    })
}

export function getUserInfo(): Promise<any> {
    return request({
        method: "get",
        url: "/getUserInfo",
    })
}

export function getDirectList(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getDirectList",
        params: params
    })
}


export function getParameter(): Promise<any> {
    return request({
        method: "get",
        url: "/getParameter",
    })
}
export function invest(params: any): Promise<any> {
    return request({
        method: "post",
        url: "/invest",
        data: formData(params)
    })
}


export function getOrderInfo(): Promise<any> {
    return request({
        method: "get",
        url: "/getOrderInfo",
    })
}


export function getOrderItemList(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getOrderItemList",
        params
    })
}

export function makeOrderItem(params: any): Promise<any> {
    return request({
        method: "post",
        url: "/makeOrderItem",
        data: formData(params)
    })
}

export function getRankInfo(): Promise<any> {
    return request({
        method: "get",
        url: "/getRankInfo",
    })
}

export function insertRank(params: any): Promise<any> {
    return request({
        method: "post",
        url: "/insertRank",
        data: formData(params)
    })
}


export function getRankList(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getRankList",
        params
    })
}

export function getRankRewardList(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getRankRewardList",
        params
    })
}

export function openBlindBox(params): Promise<any> {
    return request({
        method: "post",
        url: "/openBlindBox",
        data: formData(params)
    })
}


export function synthesis(params): Promise<any> {
    return request({
        method: "post",
        url: "/synthesis",
        data: formData(params)
    })
}
export function getMyNFT(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getMyNFT",
        params
    })
}
export function getHFMax(): Promise<any> {
    return request({
        method: "get",
        url: "/getHFMax",
    })
}


export function mintHF(params): Promise<any> {
    return request({
        method: "post",
        url: "/mintHF",
        data: formData(params)
    })
}
export function stopMintHF(params): Promise<any> {
    return request({
        method: "post",
        url: "/stopMintHF",
        data: formData(params)
    })
}
export function transferNFT(params): Promise<any> {
    return request({
        method: "post",
        url: "/transferNFT",
        data: formData(params)
    })
}
export function sellNFT(params): Promise<any> {
    return request({
        method: "post",
        url: "/sellNFT",
        data: formData(params)
    })
}
export function cancelSellNFT(params): Promise<any> {
    return request({
        method: "post",
        url: "/cancelSellNFT",
        data: formData(params)
    })
}

export function getMyNFTRecord(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getMyNFTRecord",
        params
    })
}

export function swap(params): Promise<any> {
    return request({
        method: "post",
        url: "/swap",
        data: formData(params)
    })
}

export function getSwapList(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getSwapList",
        params
    })
}

export function getPriceList(): Promise<any> {
    return request({
        method: "get",
        url: "/getPriceList",
    })
}

export function getHFPriceList(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getHFPriceList",
        params
    })
}

export function getSellNFT(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getSellNFT",
        params
    })
}

export function buyNFT(params): Promise<any> {
    return request({
        method: "post",
        url: "/buyNFT",
        data: formData(params)
    })
}

export function getRefRewardList(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getRefRewardList",
        params
    })
}

export function setDirectRate(params): Promise<any> {
    return request({
        method: "post",
        url: "/setDirectRate",
        data: formData(params)
    })
}

export function transfer(params): Promise<any> {
    return request({
        method: "post",
        url: "/transfer",
        data: formData(params)
    })
}

export function getTransferList(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getTransferList",
        params
    })
}

export function getInvestList(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getInvestList",
        params
    })
}

export function getRewardList(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getRewardList",
        params
    })
}

export function getNewsList(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getNewsList",
        params
    })
}

export function getOrderItemMax(): Promise<any> {
    return request({
        method: "get",
        url: "/getOrderItemMax",
    })
}

export function getTrxReceiveAddress(): Promise<any> {
    return request({
        method: "get",
        url: "/getTrxReceiveAddress",
    })
}
export function orderFee(): Promise<any> {
    return request({
        method: "post",
        url: "/orderFee",
    })
}
export function getReceiveList(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getReceiveList",
        params
    })
}

export function getReceiveTRXList(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getReceiveTRXList",
        params
    })
}
export function send(params): Promise<any> {
    return request({
        method: "post",
        url: "/send",
        data: formData(params)
    })
}

export function getSendList(params: { pageNum: number, pageSize: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getSendList",
        params
    })
}

export function getLeaderInfo(): Promise<any> {
    return request({
        method: "get",
        url: "/getLeaderInfo",
    })
}




export function getAnnouncementList(params: { pageNum: number, pageSize: number, languageId: number }): Promise<any> {
    return request({
        method: "get",
        url: "/getAnnouncementList",
        params: params
    })
}


const formData = (params: any) => {
    let formData = new FormData();
    for (let i in params) {
        formData.append(i, params[i])
    }
    return formData
}